﻿<%@ Page Language="C#" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Register src="~/App_Control/Dashboard.ascx" tagname="Dashboard" tagprefix="uc" %>
<%@ Register Assembly="FacebookNET.Web" Namespace="Facebook.Web" TagPrefix="fbnet" %>

<style>
.content { 	background-color:#F7F7F7; border-bottom:1px solid #D8DFEA; margin:0px; padding:10px; }
.profile_preview { background-color: White; margin: 5px 5px 5px 105px; border: dotted 1px gray; width: 406px; }
</style>

<fb:title>Profile Refresh</fb:title>
<uc:Dashboard ID="d" runat="server" />

<div class="content">
    <fb:success>
        <fb:message>Your profile has been updated.</fb:message>
        Your featured albums have been placed on your Facebook profile page.
        When your friends click on the albums they will be taken to SmugMug. 
        Remember, there is no need for them to install this application.
        <br />
        <a href="/smugmug_on_facebook/featured_albums/">Featured Albums</a>
        |
        <a href="http://www.facebook.com/profile.php?id=<%=FacebookService.Uid%>">My Profile</a>
    </fb:success>

    <div class="profile_preview">
        <img src="http://smfb.fb.willsllc.com:8080/App_Themes/Facebook/profile_header.png" />
        <asp:Literal runat="server" id="profilePreview" />
    </div>
</div>

<fbnet:FacebookApplication ID="fbApplication" runat="server" Mode="Fbml"
  ApplicationKey="78291a7a9aa9ca6a05810f67552ef95f" 
  Secret="ae36f9308102470faac48ebb387ec4ac"
  EnableDebugging="true" />

<script runat="server">
protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);
    try
    {
        SmfbService smfb = new SmfbService();
        String fbml = smfb.GetProfileFbml();
        Story story = smfb.GetMiniFeedStory();
        profilePreview.Text = fbml;
        fbApplication.Service.Profile.SetFbml(fbml, FacebookService.Uid.ToString());
        fbApplication.Service.Feed.PublishMiniFeedStory(story.Title, story.Body, story.Images);
    }
    catch (Exception ex)
    {
        Response.Write(ex.Message);
        Response.Write(ex.StackTrace);
        
    }
}
</script>
